package com.example.demo.common;

import org.springframework.util.StringUtils;

public class StringTools {
    /**
     *      截取文章正文摘要
     */
    public static String subLength(String val,int maxLength){
        if (!StringUtils.hasLength(val) || maxLength <= 0) return val;
        if (val.length() <= maxLength) return val;
        return val.substring(0,maxLength);
    }
}
